@extends('layouts.admin.admin_master')

@section('content')
  <section class="content-header">
    <h1>
      分类管理
      <small>分类修改</small>
    </h1>
    <ol class="breadcrumb">
      <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
      <li class="active">Here</li>
    </ol>
  </section>

  <!-- Main content -->
  <section class="content">
    <div class="row">
      <div class="col-md-12">
        <!-- Horizontal Form -->
        <div class="box box-info">
          <div class="box-header with-border">
            <h3 class="box-title">修改店铺首页的分类</h3>
          </div>
          <!-- /.box-header -->
          <!-- form start -->
          <form class="form-horizontal" method="post" action="{{ url('admin/shop/categories/'.$category_info->shop_cate_id) }}">
            {{ csrf_field() }}
            {{ method_field('PUT') }}
            <div class="box-body">
              <div class="form-group">
                <label for="product_name" class="col-sm-2 control-label">分类名称</label>
                <div class="col-sm-10">
                  <input type="text" id="product_name" name="name" value="{{ $category_info->name }}" class="form-control" placeholder="">
                </div>
              </div>
              <div class="form-group ">
                <label for="brand" class="col-sm-2 control-label">品牌</label>
                <div class="col-sm-10">
                  <input type="text" id="brand" name="brand" value="{{ $category_info->brand }}" class="form-control" placeholder="Enter ...">
                </div>
              </div>
              <div class="form-group ">
                <label for="description" class="col-sm-2 control-label">分类描述</label>
                <div class="col-sm-10">
                  <input type="text" id="description" name="description" value="{{ $category_info->description }}" class="form-control" placeholder="请输入分类描述（选填）">
                </div>
              </div>
              <div class="form-group">
                <label for="brand" class="col-sm-2 control-label">选择分类</label>
                <div class="col-sm-10">
                  <select class="form-control select2 select2-hidden-accessible" name="parent_id">
                    <option value="0">默认第一级分类</option>
                    @foreach ($categories as $category)
                    <option value="{{ $category->id }}">{{ $category->name }} 【{{ $category->description }}】</option>
                    @endforeach
                  </select>
                </div>
              </div>
              @if (count($errors) > 0)
                  <div class="alert alert-danger">
                      <ul>
                          @foreach ($errors->all() as $error)
                              <li>{{ $error }}</li>
                          @endforeach
                      </ul>
                  </div>
              @endif
              @if (session('success'))
                  <div class="alert alert-success">
                      {{ session('success') }}
                  </div>
              @endif

            </div>
            <!-- /.box-body -->
            <div class="box-footer text-right">
              <button type="submit" class="btn btn-default">取消</button>
              <button type="submit" class="btn btn-info ">修改</button>
            </div>
            <!-- /.box-footer -->
          </form>
        </div>
        <!-- /.box -->
      </div>
    </div>
  </section>
@endsection